package com.spring.reactive.repository;

import com.spring.reactive.model.User;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

public interface UserRepository extends ReactiveCrudRepository<User, Long> {

    @Query("select * from t_user")
    Flux<User> users();

    @Query("select * from t_user where id = :id")
    Mono<User> user(Long id);

    @Query("update t_user set age = :age, email = :email where id = :id")
    Mono<User> update(Integer age, String email, Long id);

}
